Skip to content

Conversation

hanouticelina
Copy link
Contributor

Same PR as: huggingface/huggingface.js#1563 but in Python.
Tested the PR with https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev with both local and URL images, it works as expected ✅

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the image-to-image task to the Fal.AI inference provider.

  • Implements FalAIImageToImageTask with payload preparation and response handling
  • Adds unit tests for payload and response flows
  • Registers the new task in both sync/async clients and updates the docs

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_inference_providers.py Adds tests for image-to-image payload generation and response
src/huggingface_hub/inference/_providers/fal_ai.py Implements FalAIImageToImageTask and refactors queue logic
src/huggingface_hub/inference/_providers/init.py Registers FalAIImageToImageTask in provider mapping
src/huggingface_hub/inference/_generated/_async_client.py Hooks get_response into async image_to_image
src/huggingface_hub/inference/_client.py Hooks get_response into sync image_to_image
docs/source/en/guides/inference.md Updates feature support table for image_to_image
Comments suppressed due to low confidence (2)

tests/test_inference_providers.py:426

  • Add import base64 at the top of this test file so that base64.b64encode is defined.
        }

src/huggingface_hub/inference/_providers/fal_ai.py:232

  • This return looks mis-indented (and missing the + prefix in the diff), which will cause a syntax or scope error. It should be indented to align with the rest of the method body.
        return get_session().get(url).content

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

return f"/{mapped_model}"


class FalAIQueueTask(TaskProviderHelper, ABC):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice :)

Copy link
Contributor

@SBrandeis SBrandeis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Conceptually LGTM, thanks

@hanouticelina hanouticelina requested a review from Wauplin July 3, 2025 08:24
Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@hanouticelina hanouticelina merged commit 73b8e36 into main Jul 3, 2025
26 checks passed
@hanouticelina hanouticelina deleted the support-image-to-image branch July 3, 2025 10:25
mintyleaf pushed a commit to Swarmind/huggingface_hub that referenced this pull request Jul 11, 2025
huggingface#3187)

* add image-to-image support for fal-ai

* add tests

* fix

* use helper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants